<template>
    <div>
       <table border="1px">
          <tbody>
            
                <tr v-for="item in arr" :key="item.id">
                    <td>{{ item.name }}</td>
                   <td>{{ item.price }}</td>
                </tr>
                
          </tbody>
       </table>
       <span v-for="item in arr" :key="item.id">总价：{{ zong(item) }}</span>
    </div>
</template>
<script>

  export default{
    data(){
       return{
           arr:[{
            id:1,
            name:'空调',
            price:200,
            num:1
            },
            {
             id:2,
            name:'电视',
            price:100,
            num:1
            },
            {
            id:3,
            name:'电视',
            price:100,
            num:1
            }
           ],
           arr2:[]
       }
    },
    methods:{
        zong(i){
            this.arr2.push(i)
            console.log(this.arr2)
        }
    }
  }
</script>